package com.qingcheng.service.goods;

import com.qingcheng.entity.PageResult;
import com.qingcheng.pojo.goods.Sku;
import com.qingcheng.pojo.order.OrderItem;

import java.util.List;
import java.util.Map;


/**
 * sku业务逻辑层
 */
public interface SkuService {


    public List<Sku> findAll();


    public PageResult<Sku> findPage(int page, int size);


    public List<Sku> findList(Map<String, Object> searchMap);


    public PageResult<Sku> findPage(Map<String, Object> searchMap, int page, int size);



    public Sku findById(String id);

    public void add(Sku sku);


    public void update(Sku sku);


    public void delete(String id);

    Integer findPrice(String id);

    /*检查库存是否足够*/
    Boolean deductionStock(List<OrderItem> orderItemList);

    void addToHistory(String username, String skuId);

    List<Sku> getViewHistory(String username);

    boolean addToFav(String username, String skuId);

    List<Sku> findSkuListFromFav(String username);

    void deleHistory(String username, String skuId);

    void deleFav(String username, String skuId);

    void saveAllPriceToRedis();

    void deletePriceFromRedis(String id);

    void savePriceToRedisById(String id, Integer price);

}
